//
//  SpecialButton.m
//  test1
//
//  Created by chen on 16/10/30.
//  Copyright © 2016年 chen. All rights reserved.
//

#import "SpecialButton.h"
#import "Masonry.h"

@implementation SpecialButton

-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

-(void)setupUI {
    
    //添加文字label
    UILabel *label = [[UILabel alloc]init];
    label.numberOfLines = 0;
    label.font = [UIFont systemFontOfSize:15];
    [self addSubview:label];
    self.label = label;
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(8);
        make.left.mas_equalTo(self).offset(36);
        make.right.mas_equalTo(self).offset(65);
        make.bottom.mas_equalTo(self).offset(8);
    }];
    
    //图片
    UIImageView *leftIV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 20, 20)];
    [self addSubview:leftIV];
    self.leftImageView = leftIV;
    [leftIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(label);
        make.left.mas_equalTo(self).offset(8);
    }];
    
    UIImageView *rightVI = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 30, 30)];
    [self addSubview:rightVI];
    self.rightImageView = rightVI;
    [rightVI mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(label);
        make.right.mas_equalTo(self).offset(20);
    }];
    
    
}

@end
